package imp.core.control;

import imp.core.basics.IOManager;
import imp.core.data.SessionData;
import imp.core.debug.DebugManager;


/**
 * The Activator is the main class which contains the main method and starts the program.
 * @author Patrick Arnold
 * @since 08.09.2010
 *
 */
public class Activator {

	
	/**
	 * The main method which starts the program.
	 * @param args The args parameters are optional. It can be null or have one parameter 
	 * "debug" to specify that the program should be run in debug mode.
	 */
	public static void main( String[] args) {
		
		// Delete the .debug file and .log file from the last session:
		IOManager.deleteFile( ".debug");
		IOManager.deleteFile( ".log");
		
		
		boolean debugMode = false;
		
		if( args != null) {
			if( args.length > 0) {
				if( args[0].equals( "debug")) {
					debugMode = true;
				}
			}
		}
		
		long startTime = System.currentTimeMillis();
				
		if( debugMode) {
			String[] output = { "Starting the program. Runtime: [0 ms]"};
			DebugManager.displayStringField( output, "Starting Program");
		}
		
		
		SessionData.initializeSessionData( startTime, debugMode);
		LoadManager.load();
		
		
	}
	
	
}